//导入request.js 工具
import request from "@/utils/request";

//购买订单分页列表查询
export const purchasePageListService = (params) => {
  return request.get('/purchase/findPageAll',{params:params});//两个params ，前面的是固定的，后面是自己传的参数
};
//发送添加订单请求
export const purchaseAddService = (data) => {
  return request.post('/purchase/add', {}, { params: data });
};


// 发送删除订单请求
export const purchaseDeleteService = (id) => {
  return request.delete('/purchase/delete', { params: { id: id } });
};
//发送批量删除订单请求
export const purchaseBatchDeleteService = (multipleSelection) => {
  return request.put('/purchase/batchDelete', multipleSelection );
};
//发送下载报表的请求
export const expServer =()=>{
  return request({
    url: "/purchase/export",
    method: 'get',
    responseType: 'blob' // 设置响应类型为blob
  });
}
export const PuarchaseUploadService= (file) => {
  const formData = new FormData();
  formData.append('file', file);
  return request({
    url: "/purchase/upload",
    method: 'post',
    data: formData, // 使用 data 而不是 formData
    headers: {
      'Content-Type': undefined // 让 axios 自动设置 Content-Type
    }
  });
};
export const purchaseCountAndTimeService = () => {
  return request.get('/purchase/findAllCountAndTime');
};
export const purchaseCountService = () => {
  return request.get('/purchase/findAllCount');
};